package com.baizhi.dcx.controller;

import com.baizhi.dcx.entity.User;
import com.baizhi.dcx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("user")
@CrossOrigin
public class UserControlle {
    @Autowired
    private UserService userService;

    @RequestMapping("queryAllPage")
    @ResponseBody
    public Map<String, Object> queryAllPage(int page, int pageSize){
        return userService.queryAllPage(page,pageSize);
    }
    @RequestMapping("update")
    @ResponseBody
    public Map<String, Object> update(@RequestBody User user){
        return userService.mifig(user);
    }
    @RequestMapping("queryById")
    @ResponseBody
    public User queryById(int id){
        return userService.queryById(id);
    }
}
